<?php
/*
This sends a little bit of JSON to give users different options for relating data to different vocabularies and entity stores
It's better to do this through Google Refine, but sometimes you'll want to do it via this interface.
*/

require_once( 'core.php' );
require_once( 'current_user_api.php' );

auth_ensure_user_authenticated( );
//helper_begin_long_process( );

$t_plugin_path = config_get( 'plugin_path' );
require_once( $t_plugin_path . 'DataRefine' . DIRECTORY_SEPARATOR . 'MetadataStandards.php' );
require_once( $t_plugin_path . 'DataRefine' . DIRECTORY_SEPARATOR . 'JSONstore.php' );

/*
$MetadataStandards = new MetadataStandards;
$MetadataStandards->saveMetadata();
*/
$JSONstore = new JSONstore;
$JSONstore->setDirectory("standards");
$standards = $JSONstore->read_parse_json("vocabularies");

$output = json_encode($standards, 1);

//now output for AJAX call from the Refine Login Screen
if(!isset($_GET["callback"])){
	header('Content-Type: application/json; charset=utf8');
	echo $output;
}
else{
	header('Content-Type: application/json; charset=utf8');
	$callback = $_GET["callback"];
	echo $callback."(".$output.");";
}


?>
